CREATE TABLE [dbo].[tb_Asignaturas]
(
[idAsignatura] [int] NOT NULL IDENTITY(1, 1),
[Descripcion] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Mnemo] [varchar] (14) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
[Tipo] [int] NULL,
[AsignaturaGenerica] [int] NULL,
[EsPrivada] [varchar] (1) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[idAsignaturaSageNacional] [int] NULL
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Asignaturas] ADD CONSTRAINT [PK_tb_Asignaturas_1] PRIMARY KEY CLUSTERED  ([idAsignatura]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [PK_tb_Asignaturas] ON [dbo].[tb_Asignaturas] ([idAsignatura]) ON [PRIMARY]
GO
CREATE UNIQUE NONCLUSTERED INDEX [idx_Mnemo] ON [dbo].[tb_Asignaturas] ([Mnemo]) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tb_Asignaturas] WITH NOCHECK ADD CONSTRAINT [FK_tb_Asignaturas_tb_AsignaturasGenericas] FOREIGN KEY ([AsignaturaGenerica]) REFERENCES [dbo].[tb_AsignaturasGenericas] ([idAsignaturaGenerica])
GO
ALTER TABLE [dbo].[tb_Asignaturas] WITH NOCHECK ADD CONSTRAINT [FK_tb_Asignaturas_tb_TiposEspaciosCurriculares] FOREIGN KEY ([Tipo]) REFERENCES [dbo].[tb_TiposEspaciosCurriculares] ([idTipoEspacioCurricular])
GO
